﻿using System;
using System.Collections.Generic;
using System.Web.Mvc;
using ControleRepresentante.Logic;
using ControleRepresentante.Logic.Models;
using WebSite.ViewModels.Fields;
using WebSite.ViewModels.IndexViewModels;

namespace WebSite.ViewModels.ViewModelExtensions.IndexViewModelExtensions
{
    public static class TransportadoraJolitexIndexColumns
    {
        public static Guid Codigo = new Guid("17313ac2-7256-4171-a283-461e79b71b3f");
    }

    public class TransportadoraJolitexIndexViewModel : IIndexViewModelExtension
    {
        private readonly string m_CodigoBuscaValue;

        public TransportadoraJolitexIndexViewModel(string codigoBuscaValue)
        {
            m_CodigoBuscaValue = codigoBuscaValue;
        }

        public IEnumerable<IField> GetSearchFields()
        {
            yield return new TextBoxField("Código Jolitex", "codigo", m_CodigoBuscaValue);
        }

        public bool CanEditSpecific(ModelBase modelBase)
        {
            return true;
        }

        public bool CanDeleteSpecific(ModelBase modelBase)
        {
            return true;
        }

        public void RegisterColumns(IndexColumnDefinitionsCollection indexColumnDefinitionsCollection, IIndexColumnsProvider indexColumnsProvider)
        {
            indexColumnDefinitionsCollection.Register(indexColumnsProvider[TransportadoraJolitexIndexColumns.Codigo], x => ((Transportadora)x).TransportadoraJolitex.Codigo);
        }

        public IEnumerable<TabItem> GetTabs(HtmlHelper htmlHelper)
        {
            return new TabItem[0];
        }
    }
}